﻿using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.Xml.Linq;
using System.Collections.Generic;
using Runda.CMS.Common.Utility;
using Runda.CMS.Bll;
using Runda.CMS.Common.Entity;
using log4net;

namespace Runda.CMS.Portal.Services
{
    /// <summary>
    /// Summary description for DataSyncService
    /// </summary>
    [WebService(Namespace = "http://tempuri.org/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    [System.ComponentModel.ToolboxItem(false)]
    // To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. 
     [System.Web.Script.Services.ScriptService]
    public class DataSyncService : System.Web.Services.WebService
    {

        [WebMethod(true)]
        public DataSyncServiceEntity syncdata(string syncType)
        {
            DataSyncServiceEntity entity = new DataSyncServiceEntity();
            if (syncType.ToLower().Equals("instrument")) {
                DataSynchroBll bll = new DataSynchroBll();
                bll.SynchroInstrument();
            }
            if (syncType.ToLower().Equals("bill"))
            {
                DataSynchroBll bll = new DataSynchroBll();
                bll.SynchroBill();
                new BillBll().SetBillPenaltyAwardForBusinessor(System.DateTime.Now);
            }
            if (syncType.ToLower().Equals("customer"))
            {
                DataSynchroBll bll = new DataSynchroBll();
                bll.SynchroCustomer();
            }


            entity.IsSuccess = true;
            entity.MessageUI = "数据同步完成";
            return entity;         
        }
        [WebMethod(true)]
        public DataSyncServiceEntity gendata(string genType)
        {
            DataSyncServiceEntity entity = new DataSyncServiceEntity();
            if (genType.ToLower().Equals("registertask"))
            {
                DataSynchroBll bll = new DataSynchroBll();
                bll.genData();
            }
           

            entity.IsSuccess = true;
            entity.MessageUI = "系统数据生成已完成";
            return entity;
        }
    }
}
